#include <cstdio>
#include <string>

#include "ManagerUtils/RouteManager.h"
#include "ManagerUtils/DbManager.h"

using namespace std;

int main() {
    string dbPathConfig = "db.sqlite3";
    string routePathConfig = "Config/Route.txt";

    printf("-------- 服务端管理控制台 --------\n");
    printf("当前配置信息：\n");
    printf("数据路相对路径：%s\n", dbPathConfig.c_str());
    printf("路由配置文件相对路径：%s\n", routePathConfig.c_str());
    printf("当前可用服务：\n");
    printf("[1] 向数据库中添加表\n");
    printf("[2] 添加路由\n");
    bool shouldContinue = true;
    while (shouldContinue) {
        printf("请输入上述服务的编号，输入q退出：");
        char instr = (char) getchar();
        switch (instr) {
            case '1':
                getchar();
                DbManager(dbPathConfig.c_str());
                break;
            case '2':
                getchar();
                RouteManager(routePathConfig.c_str());
                break;
            case 'q':
                shouldContinue = false;
                break;
            default:
                printf("无效指令\n");
        }
    }
}
